<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/1/18
  Time: 14:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common/head.jsp"%>
<html>
<head>
    <title>课程信息</title>
    <script src="../static/js/jquery-3.4.1.js"></script>
    <script>
        $(function() {
        var str ="";
        str+="<a  href='page/addcourse'>添加</a>";
        $(".cz").html(str)
            $.ajax({
                url:"../user/lookcourses",
                data:{},
                type:"post",
                dataType:"json",
                success:function(data){
                    var str = "";
                    for (var i in data){
                        // alert()
                        str +="<tr>" +
                            "            <td>"+data[i].courseid+"</td>" +
                            "            <td>"+data[i].coursename+"</td>" +
                            "            <td>"+data[i].clazz+"</td>" +
                            "            <td>"+data[i].tname+"</td>" +
                            "            <td>" +
                            "                <a href='../user/deletecourse?courseid="+data[i].courseid+"'>删除</a>" +
                            "                <a href='../page/updatecourse?courseid="+data[i].courseid+"'>修改</a>" +
                            "            </td>" +
                            "        </tr>"
                            // "<tr> <td>"+data[i].stuid+"</td>"
                            // +"           <td>"+data[i].stuname+"</td>" +
                            // "           <td>"+data[i].gender+"</td>" +
                            // "            <td>"+data[i].clazz+"</td>"
                            // +"<td>"+data[i].password+"</td>"+
                            // "            <td>" +
                            // "                <a href='../page/updatestudent?stuid="+data[i].stuid+"'>修改</a>" +
                            // "                <a href='../user/deletestu?stuid="+data[i].stuid+"'>删除</a>" +
                            // "            </td></tr>" ;
                    }
                    $("#table").append(str);
                }

            })
            })
    </script>
</head>
<style>
    table{
        margin-left: auto;
        margin-right: auto;
        margin-top: 100px;
    }
    td{
        width: 200px;
        height: 20px;
        text-align: center;

    }
</style>
<body>
<%--240,248,255--%>
    <table id="table" style="background-color: #f0f8ff;" border="1px solid red" cellspacing="0px"  >

        <caption><h2 >课程信息 <span class="cz" align='right' style="float: right;"></span></h2></caption>


        <tr >
            <td>课程号：</td>
            <td>课程名称：</td>
            <td>班级名称：</td>
            <td>任课老师：</td>
            <td >操作：</td>
        </tr>
<%--        <tr>--%>
<%--            <td>2</td>--%>
<%--            <td>computer</td>--%>
<%--            <td>2</td>--%>
<%--            <td>lisi</td>--%>
<%--            <td>--%>
<%--                <a href="">删除</a>--%>
<%--                <a href="">修改</a>--%>
<%--            </td>--%>
<%--        </tr>--%>
    </table>
<%@include file="common/foot.jsp" %>
</body>
</html>
